package algotithm.acwing.test801;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * @author zhouyanxiang
 * @Date 2021-01-2021/1/6-21:17
 */
public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(reader.readLine());
        String[] nums = reader.readLine().split(" ");
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = Integer.parseInt(nums[i]);
        }
        for (int i = 0; i < n; i++) {
            System.out.print(countOne(arr[i]) + " ");
        }
    }

    public static int countOne(int num) {
        int mask = 1;
        int res = 0;
        for (int i = 0; i < 32; i++) {
            if ((mask & num) != 0) {
                res++;
            }
            mask <<= 1;
        }
        return res;
    }

}
